package sql_wc;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapreduce.lib.db.DBWritable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class ReceiveTable implements DBWritable, Writable {
    private String words;

    public void write(DataOutput dataOutput) throws IOException {
        Text.writeString(dataOutput,words);
    }

    public void readFields(DataInput dataInput) throws IOException {
        words = dataInput.readUTF();
    }

    public void write(PreparedStatement statement) throws SQLException {
        statement.setString(1, words);
    }

    public void readFields(ResultSet resultSet) throws SQLException {
        words = resultSet.getString(1);
    }

    public String getWord() {
        return words;
    }

    public void setWord(String word) {
        this.words = word;
    }
}
